package com.itheima;

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.core.ValueOperations;

import java.util.concurrent.TimeUnit;

@SpringBootTest
public class RedisDemo {
    @Autowired
    private StringRedisTemplate redisTemplate;
    @Test
    public void testRedisSet(){
        ValueOperations<String, String> Operations = redisTemplate.opsForValue();
        Operations.set("uids","zhangsan",10, TimeUnit.SECONDS);

    }

    @Test
    public void testRedisGet(){
        ValueOperations<String, String> Operations = redisTemplate.opsForValue();
        String uids = Operations.get("uids");
        System.out.println(uids);
    }
}
